<!DOCTYPE html>
<HTML>

<HEAD>
    <TITLE> ZTREE DEMO </TITLE>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style>
        div {
            height: 400px;
        }

        #parent {
            width: 50%;
            background-color: aqua;
            overflow: scroll;
            box-sizing: border-box;
        }

        #son {
            //width: 100%;
            width: fit-content;
            background-color: red;
        }
    </style>
</HEAD>

<BODY>
    <div id="parent">
        <div contenteditable='true' id="son">
            HHHHHHHHHHHHH
        </div>
    </div>
</BODY>

</HTML>